export const setStore = function (key, data, sync = true) {
  if (sync) {
    wx.setStorageSync(key, data)
  } else {
    wx.setStorage(key, data)
  }
}


export const getStore = function (key, sync = true) {
  if (sync) {
    return wx.getStorageSync(key) || null
  } else {
    return wx.getStore(key) || null
  }
}

export const hasStore = function (key, sync = true) {
  const has = getStore(key, sync)

  return !!has
}

export const remove = function (key, sync = true) {
  if (sync) {
    wx.removeStorageSync(key)
  } else {
    wx.removeStorage(key)
  }
}

export const clear = function (sync = true) {
  if (sync) {
    wx.clearStoageSync()
  } else {
    wx.clearStorage()
  }
}